const listeners = []

document.addEventListener('DOMContentLoaded', function () {
    listeners?.forEach?.(callback => {
        try {
            callback?.()
        } catch (e) {

        }
    })
})

window.addEventListener('hashchange', function () {
    listeners?.forEach?.(callback => {
        try {
            callback?.()
        } catch (e) {

        }
    })
}, false);

export default function (callback: Function) {
    if (!listeners.includes(callback)) {
        listeners.push(callback)
    }
}